<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>${message("admin.product.edit")}</title>


    <link href="${base}/resources/admin/css/amazeui.css" rel="stylesheet" type="text/css" /><link href="${base}/resources/admin/css/common.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="${base}/resources/admin/js/jquery.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/jquery.tools.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/jquery.validate.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/editor/kindeditor.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/common.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/input.js"></script>
    <style type="text/css">
        .specificationSelect {
            height: 100px;
            padding: 5px;
            overflow-y: scroll;
            border: 1px solid #cccccc;
        }

        .specificationSelect li {
            float: left;
            min-width: 150px;
            _width: 200px;
        }
    </style>
    <script type="text/javascript">
        $().ready(function() {

            var $inputForm = $("#inputForm");
            var $productCategoryId = $("#productCategoryId");
            var $isMemberPrice = $("#isMemberPrice");
            var $memberPriceTr = $("#memberPriceTr");
            var $memberPrice = $("#memberPriceTr input");
            var $browserButton = $("#browserButton");
            var $productImageTable = $("#productImageTable");
            var $addProductImage = $("#addProductImage");
            var $deleteProductImage = $("a.deleteProductImage");
            var $parameterTable = $("#parameterTable");
            var $attributeTable = $("#attributeTable");
            var $specificationIds = $("#specificationSelect :checkbox");
            var $specificationProductTable = $("#specificationProductTable");
            var $addSpecificationProduct = $("#addSpecificationProduct");
            var $deleteSpecificationProduct = $("a.deleteSpecificationProduct");
            var productImageIndex = ${(product.productImages?size)!"0"};
            var previousProductCategoryId = "${product.productCategory.id}";

		[@flash_message /]

            $browserButton.browser();

            // 会员价
            $isMemberPrice.click(function() {
                if ($(this).prop("checked")) {
                    $memberPriceTr.show();
                    $memberPrice.prop("disabled", false);
                } else {
                    $memberPriceTr.hide();
                    $memberPrice.prop("disabled", true);
                }
            });

            // 增加商品图片
            $addProductImage.click(function() {
			[@compress single_line = true]
                var trHtml =
                        '<tr>
                        <td>
                        <input type="file" name="productImages[' + productImageIndex + '].file" class="productImageFile imgChange" \/>
                <span class="tips">建议上传的图片的宽高比例为1:1<\/span>
            <\/td>
            <td>
            <div class="photoChange"><\/div>
            <\/td>
            <td>
            <input type="text" name="productImages[' + productImageIndex + '].title" class="text" maxlength="200" \/>
                <\/td>
            <td>
            <input type="text" name="productImages[' + productImageIndex + '].order" class="text productImageOrder" maxlength="9" style="width: 50px;" \/>
                <\/td>
            <td>
            <a href="javascript:;" class="deleteProductImage"><i class="iconfont icon-shequshanchu del-icon" ></i><\/a>
            <\/td>
            <\/tr>';
			[/@compress]
                $productImageTable.append(trHtml);
                productImageIndex ++;
                $('.imgChange').change(function () {
                    var file = this.files[0];
                    var r = new FileReader();
                    var t = $(this);
                    r.readAsDataURL(file);
                    $(r).load(function () {
                        t.parent().next().children('.photoChange').html('<img src="' + this.result + '" alt="" style="width: 30px;height: 30px;" />');
                    })
                });
            });

            // 删除商品图片
            $deleteProductImage.live("click", function() {
                var $this = $(this);
                $.dialog({
                    type: "warn",
                    content: "${message("admin.dialog.deleteConfirm")}",
                    onOk: function() {
                        $this.closest("tr").remove();
                    }
                },260,180);
            });

            // 修改商品分类
            $productCategoryId.change(function() {
                var hasValue = false;
                $parameterTable.add($attributeTable).find(":input").each(function() {
                    if ($.trim($(this).val()) != "") {
                        hasValue = true;
                        return false;
                    }
                });
                if (hasValue) {
                    $.dialog({
                        type: "warn",
                        content: "${message("admin.product.productCategoryChangeConfirm")}",
                        width: 450,
                        onOk: function() {
                            loadParameter();
                            loadAttribute();
                            previousProductCategoryId = $productCategoryId.val();
                        },
                        onCancel: function() {
                            $productCategoryId.val(previousProductCategoryId);
                        }
                    },340,180);
                } else {
                    loadParameter();
                    loadAttribute();
                    previousProductCategoryId = $productCategoryId.val();
                }
            });

            // 加载参数
            function loadParameter() {
                $.ajax({
                    url: "parameter_groups.action",
                    type: "GET",
                    data: {id: $productCategoryId.val()},
                    dataType: "json",
                    beforeSend: function() {
                        $parameterTable.empty();
                    },
                    success: function(data) {
                        var trHtml = "";
                        $.each(data, function(i, parameterGroup) {
                            trHtml += '<tr><td style="text-align: right;"><strong>' + parameterGroup.name + ':<\/strong><\/td><td>&nbsp;<\/td><\/tr>';
                            $.each(parameterGroup.parameters, function(i, parameter) {
                            [@compress single_line = true]
                                trHtml +=
                                        '<tr>
                                        <th>' + parameter.name + ': <\/th>
                            <td>
                            <input type="text" name="parameter_' + parameter.id + '" class="text" maxlength="200" \/>
                                <\/td>
                            <\/tr>';
                            [/@compress]
                            });
                        });
                        $parameterTable.append(trHtml);
                    }
                });
            }

            // 加载属性
            function loadAttribute() {
                $.ajax({
                    url: "attributes.action",
                    type: "GET",
                    data: {id: $productCategoryId.val()},
                    dataType: "json",
                    beforeSend: function() {
                        $attributeTable.empty();
                    },
                    success: function(data) {
                        var trHtml = "";
                        $.each(data, function(i, attribute) {
                            var optionHtml = '<option value="">${message("admin.common.choose")}<\/option>';
                            $.each(attribute.options, function(j, option) {
                                optionHtml += '<option value="' + option + '">' + option + '<\/option>';
                            });
                        [@compress single_line = true]
                            trHtml +=
                                    '<tr>
                                    <th>' + attribute.name + ': <\/th>
                        <td>
                        <select name="attribute_' + attribute.id + '">
                                ' + optionHtml + '
                                <\/select>
                        <\/td>
                        <\/tr>';
                        [/@compress]
                        });
                        $attributeTable.append(trHtml);
                    }
                });
            }

            // 修改商品规格
            $specificationIds.click(function() {
                if ($specificationIds.filter(":checked").size() == 0) {
                    $specificationProductTable.find("tr:gt(1)").remove();
                }
                var $this = $(this);
                if ($this.prop("checked")) {
                    $specificationProductTable.find("td.specification_" + $this.val()).show().find("select").prop("disabled", false);
                } else {
                    $specificationProductTable.find("td.specification_" + $this.val()).hide().find("select").prop("disabled", true);
                }
            });

            // 增加规格商品
            $addSpecificationProduct.click(function() {
                if ($specificationIds.filter(":checked").size() == 0) {
                    $.message("warn", "${message("admin.product.specificationRequired")}");
                    return false;
                }
                if ($specificationProductTable.find("tr:gt(1)").size() == 0) {
                    $tr = $specificationProductTable.find("tr:eq(1)").clone().show().appendTo($specificationProductTable);
                    $tr.find("td:first").text("${message("admin.product.currentSpecification")}");
                    $tr.find("td:last").text("-");
                } else {
                    $specificationProductTable.find("tr:eq(1)").clone().show().appendTo($specificationProductTable);
                }
            });

            // 删除规格商品
            $deleteSpecificationProduct.live("click", function() {
                var $this = $(this);
                $.dialog({
                    type: "warn",
                    content: "${message("admin.dialog.deleteConfirm")}",
                    onOk: function() {
                        $this.closest("tr").remove();
                    }
                });
            });

            $.validator.addClassRules({
                memberPrice: {
                    min: 0,
                    decimal: {
                        integer: 12,
                        fraction: ${setting.priceScale}
                    }
                },
                productImageFile: {
                    required: true,
                    extension: "${setting.uploadImageExtension}"
                },
                productImageOrder: {
                    digits: true
                }
            });

            // 表单验证
            $inputForm.validate({
                rules: {
                    productCategoryId: "required",
                    name: "required",
                    sn: {
                        pattern: /^[0-9a-zA-Z_-]+$/,
                        remote: {
                            url: "check_sn.action?previousSn=${product.sn}",
                            cache: false
                        }
                    },
                    price: {
                        required: true,
                        min: 0,
                        decimal: {
                            integer: 12,
                            fraction: ${setting.priceScale}
                        }
                    },
                    weight: "digits",
                    stock: "digits",
                    order: "digits",
                },
                messages: {
                    sn: {
                        pattern: "${message("admin.validate.illegal")}",
                        remote: "${message("admin.validate.exist")}"
                    }
                },
                submitHandler: function(form) {
                    if ($specificationIds.filter(":checked").size() > 0 && $specificationProductTable.find("tr:gt(1)").size() == 0) {
                        $.message("warn", "${message("admin.product.specificationProductRequired")}");
                        return false;
                    } else {
                        var isRepeats = false;
                        var parameters = new Array();
                        $specificationProductTable.find("tr:gt(1)").each(function() {
                            var parameter = $(this).find("select").serialize();
                            if ($.inArray(parameter, parameters) >= 0) {
                                $.message("warn", "${message("admin.product.specificationValueRepeat")}");
                                isRepeats = true;
                                return false;
                            } else {
                                parameters.push(parameter);
                            }
                        });
                        if (!isRepeats) {
                            $specificationProductTable.find("tr:eq(1)").find("select").prop("disabled", true);
                            addCookie("previousProductCategoryId", $productCategoryId.val(), {expires: 24 * 60 * 60});
                            form.submit();
                        }
                    }
                }
            });

            $('.imgChange').change(function () {
                var file = this.files[0];
                var r = new FileReader();
                var t = $(this);
                r.readAsDataURL(file);
                $(r).load(function () {
                    t.parent().next().children('.photoChange').html('<img src="' + this.result + '" alt="" style="width: 30px;height: 30px;" />');
                })
            });

        });
    </script>
</head>
<body>
<div class="path">
    <a href="${base}/asl-admin/common/index.htm">${message("admin.path.index")}</a> &raquo; ${message("admin.product.edit")}
</div>
<form id="inputForm" action="update.htm" method="post" enctype="multipart/form-data">
    <input type="hidden" name="id" value="${product.id}" />
    <ul id="tab" class="tab">
        <li>
            <input type="button" value="${message("admin.product.base")}" />
        </li>
        <li>
            <input type="button" value="${message("admin.product.introduction")}" />
        </li>
        <li>
            <input type="button" value="${message("admin.product.productImage")}" />
        </li>
        <li>
            <input type="button" value="${message("admin.product.parameter")}" />
        </li>
        <li>
            <input type="button" value="${message("admin.product.attribute")}" />
        </li>
        <li>
            <input type="button" value="${message("admin.product.specification")}" />
        </li>
    </ul>
    <table class="input tabContent">
	[#if product.specifications?has_content]
        <tr>
            <th>
			${message("Product.specifications")}:
            </th>
            <td>
				[#list product.specificationValues as specificationValue]
                        ${specificationValue.name}
                    [/#list]
            </td>
        </tr>
	[/#if]
	[#if product.validPromotions?has_content]
        <tr>
            <th>
			${message("Product.promotions")}:
            </th>
            <td>
				[#list product.validPromotions as promotion]
                    <p>
					${promotion.name}
						[#if promotion.beginDate?? || promotion.endDate??]
                            [${promotion.beginDate} ~ ${promotion.endDate}]
						[/#if]
                    </p>
				[/#list]
            </td>
        </tr>
	[/#if]
        <tr>
            <th>
			${message("Product.productCategory")}:
            </th>
            <td>
                <select id="productCategoryId" name="productCategoryId">
				[#list productCategoryTree as productCategory]
                    <option value="${productCategory.id}"[#if productCategory == product.productCategory] selected="selected"[/#if]  [#if productCategory.grade=="0"]disabled[/#if]>
						[#if productCategory.grade != 0]
							[#list 1..productCategory.grade as i]
                                &nbsp;&nbsp;
							[/#list]
						[/#if]
					${productCategory.name}
                    </option>
				[/#list]
                </select>
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>${message("Product.name")}:
            </th>
            <td>
                <input type="text" name="name" class="text" value="${product.name}" maxlength="26" /> 建议字数超过10个字
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.pinyin")}:
            </th>
            <td>
                <input type="text" name="pinyin" class="text" value="${product.pinyin}" maxlength="200" disabled="true" readOnly="true" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.keyword")}:
            </th>
            <td>
                <input type="text" name="keyword" class="text" value="${product.keyword}" maxlength="200" title="${message("admin.product.keywordTitle")}" disabled="true" readOnly="true"  />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.sn")}:
            </th>
            <td>
                <input type="text" name="sn" class="text" value="${product.sn}" maxlength="100" title="${message("admin.product.snTitle")}" />
            </td>
        </tr>
        <tr>
            <th>
                <span class="requiredField">*</span>价格:
            </th>
            <td>
                <input type="text" name="price" class="text" value="${product.price}" maxlength="16" />
            </td>
        </tr>
        <tr>
            <th>
                促销价:
            </th>
            <td>
                <input type="text" name="promotionPrice" class="text" value="${product.promotionPrice}" maxlength="16" />
            </td>
        </tr>
        <tr id="memberPriceTr"[#if !product.memberPrice?has_content] class="hidden"[/#if]>
            <th>
                &nbsp;
            </th>
            <td>
			[#list memberRanks as memberRank]
			${memberRank.name}: <input type="text" name="memberPrice_${memberRank.id}" class="text memberPrice" value="${product.memberPrice.get(memberRank)}" maxlength="16" style="width: 60px; margin-right: 6px;"[#if !product.memberPrice?has_content] disabled="disabled"[/#if] />
			[/#list]
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.image")}:
            </th>
            <td>
                <span class="fieldSet">
                    <input type="text" name="image" class="text" value="${product.image}" maxlength="200" title="${message("admin.product.imageTitle")}" />
                    <input type="button" id="browserButton" class="button" value="${message("admin.browser.select")}" /> 建议使用1:1的图片尺寸
				[#if product.image??]
                    <img src="${product.image}" class="browserImage" />
				[/#if]
                </span>
            </td>
        </tr>
        <tr>
            <th>${message("admin.common.order")}:</th>
            <td>
                <input type="text" name="order" class="text" maxlength="9" title="${message("admin.common.order")}" value="${product.order}" />
            </td>
        </tr>
        <tr>
            <th>销量:</th>
            <td>
			${product.sales}
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.unit")}:
            </th>
            <td>
			${product.unit}
                <input type="hidden" name="unit" class="text" maxlength="200" value="${product.unit}" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.weight")}:
            </th>
            <td>
                <input type="text" name="weight" class="text" value="${product.weight}" maxlength="9" title="${message("admin.product.weightTitle")}" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.allocatedStock")}:
            </th>
            <td>
			${product.allocatedStock}
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.stock")}:
            </th>
            <td>
                <input type="text" name="stock" class="text" value="${product.stock}" maxlength="9" title="${message("admin.product.stockTitle")}" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.stockMemo")}:
            </th>
            <td>
                <input type="text" name="stockMemo" class="text" value="${product.stockMemo}" maxlength="200" />
            </td>
        </tr>
        <tr>
            <th>
                发布:
            </th>
            <td>
                <label>
                    <input type="checkbox" name="isMarketable" value="true"[#if product.isMarketable] checked="checked"[/#if] />是否上架
                    <input type="hidden" name="_isMarketable" value="false" />
                </label>
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.memo")}:
            </th>
            <td>
                <input type="text" name="memo" class="text" value="${product.memo}" maxlength="200" />
            </td>
        </tr>

        <tr>
            <th>
			${message("Product.seoTitle")}:
            </th>
            <td>
                <input type="text" name="seoTitle" class="text" value="${product.seoTitle}" maxlength="200" title="${message("admin.product.seoTitle")}" disabled="true" readOnly="true" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.seoKeywords")}:
            </th>
            <td>
                <input type="text" name="seoKeywords" class="text" value="${product.seoKeywords}" maxlength="200" title="${message("admin.product.seoKeywords")}" disabled="true" readOnly="true" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.seoDescription")}:
            </th>
            <td>
                <input type="text" name="seoDescription" class="text" value="${product.seoDescription}" maxlength="200" title="${message("admin.product.seoDescription")}" disabled="true" readOnly="true" />
            </td>
        </tr>
        <tr>
            <th>
			${message("Product.hits")}:
            </th>
            <td>
			${product.hits}
            </td>
        </tr>
    </table>
    <table class="input tabContent">
        <tr>
            <th>
			${message("Product.smallIntroduction")}:
            </th>
            <td>
                <input type="text" name="smallIntroduction" class="text text-long" value="${product.smallIntroduction}" maxlength="30" /> 建议字数超过10个字
            </td>
        </tr>
        <tr>
            <th>
                商品详情:
            </th>
            <td>
                <textarea id="editor" name="introduction" class="editor" style="width: 100%;height: 999px">${product.introduction?html}</textarea>
            </td>
        </tr>
    </table>
    <table id="productImageTable" class="input tabContent">
        <tr>
            <td colspan="4">
                <a href="javascript:;" id="addProductImage" class="button">${message("admin.product.addProductImage")}</a>
            </td>
        </tr>
        <tr class="title">
            <th>
			${message("ProductImage.file")}
            </th>
            <th>
                预览
            </th>
            <th>
			${message("ProductImage.title")}
            </th>
            <th>
			${message("admin.common.order")}
            </th>
            <th>
			${message("admin.common.delete")}
            </th>
        </tr>
	[#list product.productImages as productImage]
        <tr>
            <td>
                <input type="hidden" name="productImages[${productImage_index}].source" value="${productImage.source}" />
                <input type="hidden" name="productImages[${productImage_index}].large" value="${productImage.large}" />
                <input type="hidden" name="productImages[${productImage_index}].medium" value="${productImage.medium}" />
                <input type="hidden" name="productImages[${productImage_index}].thumbnail" value="${productImage.thumbnail}" />
                <input type="file" name="productImages[${productImage_index}].file" class="productImageFile ignore imgChange" />
			[#--<a href="${productImage.large}" target="_blank">${message("admin.common.view")}</a>--]
                <span class="tips">建议上传的图片的宽高比例为1:1</span>

            </td>
            <td>
                <div class="photoChange">
                    <img src="${productImage.source}" alt="" style="width: 30px;height: 30px;" />
                </div>
            </td>
            <td>
                <input type="text" name="productImages[${productImage_index}].title" class="text" maxlength="200" value="${productImage.title}" />
            </td>
            <td>
                <input type="text" name="productImages[${productImage_index}].order" class="text productImageOrder" value="${productImage.order}" maxlength="9" style="width: 50px;" />
            </td>
            <td>
                <a href="javascript:;" class="deleteProductImage"><i class="iconfont icon-shequshanchu del-icon" ></i></a>
            </td>
        </tr>
	[/#list]
    </table>
    <table id="parameterTable" class="input tabContent">
	[#list product.productCategory.parameterGroups as parameterGroup]
        <tr>
            <td style="text-align: right; padding-right: 10px;">
                <strong>${parameterGroup.name}:</strong>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
		[#list parameterGroup.parameters as parameter]
            <tr>
                <th>${parameter.name}:</th>
                <td>
                    <input type="text" name="parameter_${parameter.id}" class="text" value="${product.parameterValue.get(parameter)}" maxlength="200" />
                </td>
            </tr>
		[/#list]
	[/#list]
    </table>
    <table id="attributeTable" class="input tabContent">
	[#list product.productCategory.attributes as attribute]
        <tr>
            <th>${attribute.name}:</th>
            <td>
				[#list attribute.options as option]
                    <label><input type="checkbox" name="attribute_${attribute.id}" value="${option}"
						[#if product.getAttributeValue(attribute)??]
							[#list product.getAttributeValue(attribute)?split(",") as a]
								[#if option == a ] checked [/#if]
							[/#list]
						[/#if]
                    />${option}</label> &nbsp;&nbsp;
				[/#list]
            </td>
        </tr>
	[/#list]
    </table>
    <table class="input tabContent">
        <tr class="title">
            <th>
			${message("admin.product.selectSpecification")}:
            </th>
        </tr>
        <tr>
            <td>
                <div id="specificationSelect" class="specificationSelect">
                    <ul>
					[#list specifications as specification]
                        <li>
                            <label>
                                <input type="checkbox" name="specificationIds" value="${specification.id}"[#if product.specifications?seq_contains(specification)] checked="checked"[/#if] />${specification.name}
								[#if specification.memo??]
                                    <span class="gray">[${specification.memo}]</span>
								[/#if]
                            </label>
                        </li>
					[/#list]
                    </ul>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <a href="javascript:;" id="addSpecificationProduct" class="button">${message("admin.product.addSpecificationProduct")}</a>
            </td>
        </tr>
        <tr>
            <td>
                <table id="specificationProductTable" class="input">
                    <tr class="title">
                        <td width="60">
                            &nbsp;
                        </td>
					[#list specifications as specification]
                        <td class="specification_${specification.id}[#if !product.specifications?seq_contains(specification)] hidden[/#if]">
						${specification.name}
							[#if specification.memo??]
                                <span class="gray">[${specification.memo}]</span>
							[/#if]
                        </td>
					[/#list]
                        <td>
						${message("admin.common.handle")}
                        </td>
                    </tr>
                    <tr class="hidden">
                        <td>
                            &nbsp;
                        </td>
					[#list specifications as specification]
                        <td class="specification_${specification.id}[#if !product.specifications?seq_contains(specification)] hidden[/#if]">
                            <select name="specification_${specification.id}"[#if !product.specifications?seq_contains(specification)] disabled="disabled"[/#if]>
								[#list specification.specificationValues as specificationValue]
                                    <option value="${specificationValue.id}">${specificationValue.name}</option>
								[/#list]
                            </select>
                        </td>
					[/#list]
                        <td>
                            <a href="javascript:;" class="deleteSpecificationProduct"><i class="iconfont icon-shequshanchu del-icon" ></i></a>
                        </td>
                    </tr>
				[#if product.specifications?has_content]
                    <tr>
                        <td>
						${message("admin.product.currentSpecification")}
                            <input type="hidden" name="specificationProductIds" value="${product.id}" />
                        </td>
						[#list specifications as specification]
                            <td class="specification_${specification.id}[#if !product.specifications?seq_contains(specification)] hidden[/#if]">
                                <select name="specification_${specification.id}"[#if !product.specifications?seq_contains(specification)] disabled="disabled"[/#if]>
									[#list specification.specificationValues as specificationValue]
                                        <option value="${specificationValue.id}"[#if product.specificationValues?seq_contains(specificationValue)] selected="selected"[/#if]>${specificationValue.name}</option>
									[/#list]
                                </select>
                            </td>
						[/#list]
                        <td>
                            -
                        </td>
                    </tr>
				[/#if]
				[#list product.siblings as specificationProduct]
                    <tr>
                        <td>
                            &nbsp;
                            <input type="hidden" name="specificationProductIds" value="${specificationProduct.id}" />
                        </td>
						[#list specifications as specification]
                            <td class="specification_${specification.id}[#if !specificationProduct.specifications?seq_contains(specification)] hidden[/#if]">
                                <select name="specification_${specification.id}"[#if !specificationProduct.specifications?seq_contains(specification)] disabled="disabled"[/#if]>
									[#list specification.specificationValues as specificationValue]
                                        <option value="${specificationValue.id}"[#if specificationProduct.specificationValues?seq_contains(specificationValue)] selected="selected"[/#if]>${specificationValue.name}</option>
									[/#list]
                                </select>
                            </td>
						[/#list]
                        <td>
                            <a href="javascript:;" class="deleteSpecificationProduct"><i class="iconfont icon-shequshanchu del-icon" ></i></a>
                            <a href="edit.htm?id=${specificationProduct.id}"><i class="iconfont icon-bianji edit-icon" ></i></a>
                        </td>
                    </tr>
				[/#list]
                </table>
            </td>
        </tr>
    </table>
    <table class="input">
        <tr>
            <th>
                &nbsp;
            </th>
            <td>
                <input type="submit" class="button" value="${message("admin.common.submit")}" />
                <input type="button" class="button" value="${message("admin.common.back")}" onclick="location.href='list.htm'" />
            </td>
        </tr>
    </table>
</form>
</body>
</html>
